home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-10 | 8.1 KB | 286 lines | [TEXT/MPS ] |
- (*
- File: MixedMode.mod
-
- Contains: Mixed Mode Manager Interfaces.
-
- Version: Technology: System 7.5
- Package: Universal Interfaces 2.0 in “MPW Latest” on ETO #17
-
- Copyright: © 1984-1995 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs.applelink.apple.com
- AppleLink: APPLE.BUGS
-
- *)
-
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE MixedMode;
-
- IMPORT SYSTEM, Types;
-
- (* $PUSH*)
- (* $ALIGN MAC68K*)
- (* $LibExport+*)
-
- CONST
- kRoutineDescriptorVersion* = 7;
-
- (* MixedModeMagic Magic Cookie/Trap number *)
- _MixedModeMagic* = $AAFE;
-
- (* Calling Conventions *)
-
- TYPE
- CallingConventionType* = INTEGER;
-
-
- CONST
- kPascalStackBased* = 0;
- kCStackBased* = 1;
- kRegisterBased* = 2;
- kD0DispatchedPascalStackBased* = 8;
- kD1DispatchedPascalStackBased* = 12;
- kD0DispatchedCStackBased* = 9;
- kStackDispatchedPascalStackBased* = 14;
- kThinkCStackBased* = 5;
-
- (* ISA Types *)
-
- TYPE
- ISAType* = Types.SInt8;
-
-
- CONST
- kM68kISA* = 0;
- kPowerPCISA* = 1;
-
- (* RTA Types *)
-
- TYPE
- RTAType* = Types.SInt8;
-
-
- CONST
- kOld68kRTA* = 0 * (16);
- kPowerPCRTA* = 0 * (16);
- kCFM68kRTA* = 1 * (16);
-
- (*$IF GENERATINGPOWERPC *)
- GetCurrentISA* = kPowerPCISA;
- GetCurrentRTA* = kPowerPCRTA;
-
- (*$ELSE*)
- (*$IF GENERATINGCFM *)
- GetCurrentISA* = kM68kISA;
- GetCurrentRTA* = kCFM68kRTA;
-
- (*$ELSE*)
- GetCurrentISA* = kM68kISA;
- GetCurrentRTA* = kOld68kRTA;
-
- (*$END*)
- (*$END*)
- GetCurrentArchitecture* = 0+(GetCurrentISA + GetCurrentRTA);
-
- kRegisterD0* = 0;
- kRegisterD1* = 1;
- kRegisterD2* = 2;
- kRegisterD3* = 3;
- kRegisterD4* = 8;
- kRegisterD5* = 9;
- kRegisterD6* = 10;
- kRegisterD7* = 11;
- kRegisterA0* = 4;
- kRegisterA1* = 5;
- kRegisterA2* = 6;
- kRegisterA3* = 7;
- kRegisterA4* = 12;
- kRegisterA5* = 13;
- kRegisterA6* = 14;
- (* A7 is the same as the PowerPC SP *)
- kCCRegisterCBit* = 16;
- kCCRegisterVBit* = 17;
- kCCRegisterZBit* = 18;
- kCCRegisterNBit* = 19;
- kCCRegisterXBit* = 20;
-
-
- TYPE
- registerSelectorType* = INTEGER;
-
- (* SizeCodes we use everywhere *)
-
- CONST
- kNoByteCode* = 0;
- kOneByteCode* = 1;
- kTwoByteCode* = 2;
- kFourByteCode* = 3;
-
- (* Mixed Mode Routine Records *)
-
- TYPE
- ProcInfoType* = LONGINT;
-
- (* Routine Flag Bits *)
- RoutineFlagsType* = INTEGER;
-
-
- CONST
- kProcDescriptorIsAbsolute* = $00;
- kProcDescriptorIsRelative* = $01;
-
- kFragmentIsPrepared* = $00;
- kFragmentNeedsPreparing* = $02;
-
- kUseCurrentISA* = $00;
- kUseNativeISA* = $04;
-
- kPassSelector* = $0;
- kDontPassSelector* = $08;
-
- kRoutineIsNotDispatchedDefaultRoutine* = $0;
- kRoutineIsDispatchedDefaultRoutine* = $10;
-
-
- TYPE
- RoutineRecord* = RECORD
- procInfo*: ProcInfoType; (* calling conventions *)
- reserved1*: Types.SInt8; (* Must be 0 *)
- ISA*: ISAType; (* Instruction Set Architecture *)
- routineFlags*: RoutineFlagsType; (* Flags for each routine *)
- procDescriptor*: Types.ProcPtr; (* Where is the thing we’re calling? *)
- reserved2*: LONGINT; (* Must be 0 *)
- selector*: LONGINT; (* For dispatched routines, the selector *)
- END;
-
- RoutineRecordPtr* = POINTER TO RoutineRecord;
- RoutineRecordHandle* = HANDLE TO RoutineRecord (*ΔΔ POINTER TO RoutineRecordPtr*);
-
- (* Mixed Mode Routine Descriptors *)
- (* Definitions of the Routine Descriptor Flag Bits *)
- RDFlagsType* = Types.UInt8;
-
-
- CONST
- kSelectorsAreNotIndexable* = $00;
- kSelectorsAreIndexable* = $01;
-
- (* Routine Descriptor Structure *)
-
- TYPE
- RoutineDescriptor* = (*ΔΔPACKEDΔΔ*) RECORD
- goMixedModeTrap*: INTEGER; (* Our A-Trap *)
- version*: Types.SInt8; (* Current Routine Descriptor version *)
- routineDescriptorFlags*: RDFlagsType; (* Routine Descriptor Flags *)
- reserved1*: LONGINT; (* Unused, must be zero *)
- reserved2*: Types.UInt8; (* Unused, must be zero *)
- selectorInfo*: Types.UInt8; (* If a dispatched routine, calling convention, else 0 *)
- routineCount*: INTEGER; (* Number of routines in this RD *)
- routineRecords*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF RoutineRecord; (* The individual routines *)
- END;
-
- RoutineDescriptorPtr* = POINTER TO RoutineDescriptor;
- RoutineDescriptorHandle* = HANDLE TO RoutineDescriptor (*ΔΔ POINTER TO RoutineDescriptorPtr*);
-
-
- CONST
- (* Calling Convention Offsets *)
- kCallingConventionWidth* = 4;
- kCallingConventionPhase* = 0;
- kCallingConventionMask* = $F;
- (* Result Offsets *)
- kResultSizeWidth* = 2;
- kResultSizePhase* = kCallingConventionWidth;
- kResultSizeMask* = $30;
- (* Parameter offsets & widths *)
- kStackParameterWidth* = 2;
- kStackParameterPhase* = 0+(kCallingConventionWidth + kResultSizeWidth);
- kStackParameterMask* = $FFFFFFC0;
- (* Register Result Location offsets & widths *)
- kRegisterResultLocationWidth* = 5;
- kRegisterResultLocationPhase* = 0+(kCallingConventionWidth + kResultSizeWidth);
- (* Register Parameter offsets & widths *)
- kRegisterParameterWidth* = 5;
- kRegisterParameterPhase* = 0+(kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth);
- kRegisterParameterMask* = $7FFFF800;
- kRegisterParameterSizePhase* = 0;
- kRegisterParameterSizeWidth* = 2;
- kRegisterParameterWhichPhase* = kRegisterParameterSizeWidth;
- kRegisterParameterWhichWidth* = 3;
- (* Dispatched Stack Routine Selector offsets & widths *)
- kDispatchedSelectorSizeWidth* = 2;
- kDispatchedSelectorSizePhase* = 0+(kCallingConventionWidth + kResultSizeWidth);
- (* Dispatched Stack Routine Parameter offsets *)
- kDispatchedParameterPhase* = 0+(kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth);
- (* Special Case offsets & widths *)
- kSpecialCaseSelectorWidth* = 6;
- kSpecialCaseSelectorPhase* = kCallingConventionWidth;
- kSpecialCaseSelectorMask* = $3F0;
- (* Components.Component Manager Special Case offsets & widths *)
- kComponentMgrResultSizeWidth* = 2;
- kComponentMgrResultSizePhase* = kCallingConventionWidth + kSpecialCaseSelectorWidth; (* 4 + 6* = 10 *)
- kComponentMgrParameterWidth* = 2;
- kComponentMgrParameterPhase* = kComponentMgrResultSizePhase + kComponentMgrResultSizeWidth; (* 10 + 2* = 12 *)
-
- kSpecialCase* = $0000000F;
-
- (* all of the special cases enumerated. The selector field is 6 bits wide *)
- kSpecialCaseHighHook* = 0;
- kSpecialCaseCaretHook* = 0; (* same as kSpecialCaseHighHook *)
- kSpecialCaseEOLHook* = 1;
- kSpecialCaseWidthHook* = 2;
- kSpecialCaseTextWidthHook* = 2; (* same as kSpecialCaseWidthHook *)
- kSpecialCaseNWidthHook* = 3;
- kSpecialCaseDrawHook* = 4;
- kSpecialCaseHitTestHook* = 5;
- kSpecialCaseTEFindWord* = 6;
- kSpecialCaseProtocolHandler* = 7;
- kSpecialCaseSocketListener* = 8;
- kSpecialCaseTERecalc* = 9;
- kSpecialCaseTEDoText* = 10;
- kSpecialCaseGNEFilterProc* = 11;
- kSpecialCaseMBarHook* = 12;
- kSpecialCaseComponentMgr* = 13;
-
- (*$IF GENERATINGCFM *)
-
- PROCEDURE NewRoutineDescriptor*(theProc: Types.ProcPtr; theProcInfo: ProcInfoType; theISA: ByteParameter): UniversalProcPtr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7000, $AA59;
- (*$END*)
- PROCEDURE DisposeRoutineDescriptor*(theProcPtr: UniversalProcPtr);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7001, $AA59;
- (*$END*)
- PROCEDURE NewFatRoutineDescriptor*(theM68kProc: Types.ProcPtr; thePowerPCProc: Types.ProcPtr; theProcInfo: ProcInfoType): UniversalProcPtr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7002, $AA59;
- (*$END*)
- (*$ELSE*)
-
- PROCEDURE NewRoutineDescriptor*(theProc: Types.ProcPtr; theProcInfo: ProcInfoType; theISA: Types.ByteParameter): Types.UniversalProcPtr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $5C4F, $2E9F;
- (*$END*)
- PROCEDURE DisposeRoutineDescriptor*(theProcPtr: Types.UniversalProcPtr);
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $584F;
- (*$END*)
- (*$END*)
- (*$IF CFMSYSTEMCALLS *)
- (*$IF NOT LSPWRP & NOT LSP68K*)
- PROCEDURE CallUniversalProc*(theProcPtr: Types.UniversalProcPtr; procInfo: ProcInfoType; ...): LONGINT; C;
- PROCEDURE CallOSTrapUniversalProc*(theProcPtr: Types.UniversalProcPtr; procInfo: ProcInfoType; ...): LONGINT; C;
- (*$END*)
- (*$END*)
-
- (* $ALIGN RESET*)
- (* $POP*)
-
- END MixedMode.
-